/* GUI CONVERTED from rcsfidmt.p (converter v1.75) Tue Jun 12 15:02:04 2001 */
/* rcsfidmt.p - Release Management Customer Schedules                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.7.1.3 $                                                     */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 7.3    LAST MODIFIED: 01/26/93           BY: WUG *GB74*    */
/* REVISION: 7.3    LAST MODIFIED: 10/21/93           BY: WUG *GG64*    */
/* REVISION: 7.3    LAST MODIFIED: 12/06/93           BY: WUG *GH72*    */
/* REVISION: 7.5    LAST MODIFIED: 10/24/94           BY: mwd *J034*    */
/* REVISION: 7.3    LAST MODIFIED: 01/23/95           BY: RWA *G0CW*     */
/* REVISION: 7.3    LAST MODIFIED: 05/27/97           BY: AXV *K0DK*     */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan    */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan    */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                  */
/* $Revision: 1.7.1.3 $    BY: Katie Hilbert  DATE: 05/25/01 ECO: *P00R*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcsfidmt_p_1 "Site"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcsfidmt_p_2 "Site EDI ID"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcsfidmt_p_3 "Site Shipping Label ID"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcsfidmt_p_4 "Address"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */
/*
SHIP-FROM IDENTIFIER MAINT

THIS PROGRAM MAINTAINS IDENTIFIERS THAT A SELECTED SHIP-TO
KNOWS OUR SHIP-FROM AS.
*/

define  variable shipfrom as character label {&rcsfidmt_p_1}.
define  variable shipto as character label {&rcsfidmt_p_4}.
define  variable barcode_supplier_id as character format "x(15)"
   label {&rcsfidmt_p_3}.
define  variable edi_supplier_id as character format "x(24)"
   label {&rcsfidmt_p_2}.
define  variable del-yn like mfc_logical.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
shipto               colon 30
   ad_name              no-label
   shipfrom             colon 30
   si_desc              no-label
   skip(1)
   barcode_supplier_id  colon 30
   edi_supplier_id      colon 30
 SKIP(.4)  /*GUI*/
with frame a width 80 attr-space side-labels NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.

   prompt-for shipto shipfrom with frame a
   editing:
      if frame-field = "shipto" then do:
         {mfnp05.i qad_wkfl qad_index1 "qad_key1 = ""sfst_det"""
            qad_key2 "input shipto"}

         if recno <> ? then do:
            find ad_mstr where ad_addr = qad_charfld[1] no-lock.
            find si_mstr where si_site = qad_charfld[2] no-lock.

            display
               qad_charfld[1] @ shipto
               ad_name
               qad_charfld[2] @ shipfrom
               si_desc
               qad_charfld[3] @ barcode_supplier_id
               qad_charfld[4] @ edi_supplier_id.
         end.
      end.
      else
         if frame-field = "shipfrom" then do:
         {mfnp05.i qad_wkfl qad_index1
            "qad_key1 = ""sfst_det"" and qad_key2 begins input shipto"
            qad_key2 "string(input shipto,""x(8)"") + input shipfrom"}

         if recno <> ? then do:
            find ad_mstr where ad_addr = qad_charfld[1] no-lock.
            find si_mstr where si_site = qad_charfld[2] no-lock.

            display
               qad_charfld[1] @ shipto
               ad_name
               qad_charfld[2] @ shipfrom
               si_desc
               qad_charfld[3] @ barcode_supplier_id
               qad_charfld[4] @ edi_supplier_id.
         end.
      end.
      else do:
         status input.
         readkey.
         apply lastkey.
      end.
   end.

   assign shipto shipfrom.

   find ad_mstr where ad_addr = shipto no-lock no-error.
   if not available ad_mstr then do:
      {pxmsg.i &MSGNUM=8129 &ERRORLEVEL=3}
      next-prompt shipto.
      undo, retry.
   end.

   find si_mstr where si_site = shipfrom no-lock no-error.
   if not available si_mstr then do:
      {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3} /* SITE DOES NOT EXIST */
      next-prompt shipfrom.
      undo, retry.
   end.

   {gprun.i ""gpsiver.p""
      "(input si_site, input recid(si_mstr), output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

   if return_int = 0 then do:
      {pxmsg.i &MSGNUM=725 &ERRORLEVEL=3}
      /*USER DOES NOT HAVE ACCESS TO THIS SITE */
      next-prompt shipfrom.
      undo, retry.
   end.

   find qad_wkfl where qad_key1 = "sfst_det"
      and qad_key2 = string(shipto,"x(8)") + shipfrom
      exclusive-lock no-error.

   if not available qad_wkfl then do:
      {pxmsg.i &MSGNUM=1 &ERRORLEVEL=1}
      create qad_wkfl.
      assign
         qad_key1 = "sfst_det"
         qad_key2 = string(shipto,"x(8)") + shipfrom
         qad_charfld[1] = shipto
         qad_charfld[2] = shipfrom.
   end.

   display
      qad_charfld[1] @ shipto
      ad_name
      qad_charfld[2] @ shipfrom
      si_desc
      qad_charfld[3] @ barcode_supplier_id
      qad_charfld[4] @ edi_supplier_id.

   ststatus = stline[2].
   status input ststatus.
   del-yn = no.

   set
      barcode_supplier_id
      edi_supplier_id
      go-on (F5 CTRL-D)
   with frame a.

   /* DELETE */
   if lastkey = keycode("F5") or lastkey = keycode("CTRL-D") then do:
      del-yn = yes.
      {pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=del-yn
               &CONFIRM-TYPE='LOGICAL'}
      if del-yn = no then undo.
      delete qad_wkfl.
      clear.
      next.
   end.

   assign
      qad_charfld[3] = barcode_supplier_id
      qad_charfld[4] = edi_supplier_id.

end.
/*GUI*/ if global-beam-me-up then undo, leave.

